package com.honglang.module.article.service;

import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Transactional;

import com.honglang.common.tools.Pager;
import com.honglang.module.article.entity.BlogArticle;
import com.honglang.module.article.entity.BlogArticleComment;


public interface BlogArticleManager {
	/**
	 * create a blogArticle from a map which stores the information of the blogArticle;
	 * @param map
	 * @return
	 */
	@Transactional(readOnly = true)
	public BlogArticle createBlogArtilce(Map<String,String> map);
	
	

	/**
	 * update a blogArticle from a map which stores the information of the blogArticle;
	 * @param map
	 * @return
	 */
	@Transactional(readOnly = true)
	public BlogArticle updateBlogArtilce(Map<String,String> map,BlogArticle blogArticle);
	
	
	/**
	 * persistence a blogArticle
	 * @param blogArticle
	 */
	@Transactional(readOnly = false)
	public void saveBlogArticle(BlogArticle blogArticle);
	
	

	/**
	 * get all the blogArticles;
	 * @return
	 */
	@Transactional(readOnly = true)
	public List<BlogArticle> getAllBlogArticle();
	
	
	
	/**
	 * return the pager of blogArticleList at the page of pageNo;
	 * @param pageSize
	 * @param pageNo
	 * @return
	 */
	@Transactional(readOnly = true)
	public Pager getBlogArticleInPager(int pageSize,int pageNo);
	
	
	

	/**
	 * get the blogArticle by id;
	 * @param blogArticleId
	 * @return
	 */
	@Transactional(readOnly = true)
	public BlogArticle getBlogAritcleById(Integer blogArticleId);

	

	
	/**
	 * delete blogArticle by id;
	 * @param blogArticleId
	 */
	@Transactional(readOnly = false)
	public void deleteBlogArticle(Integer blogArticleId);


	/**
	 * delete blogArticles which id is in the blogArticlesIds;
	 * @param blogArticleIds
	 */
	@Transactional(readOnly = false)
	public void batchDeleteBlogArticle(String blogArticleIds);
	
	
	/**
	 * GET the pager of blogArticleComment ,return the map which include the pager info and comments;
	 * @param pageSize
	 * @param pageNo
	 * @param blogArticleId
	 * @return
	 */
	@Transactional(readOnly = true)
	public Map<String,Object> getBlogArticleCommentPerPage(int pageSize,int pageNo,Integer blogArticleId);
	
	
	/**
	 * create a BlogArticleComment from a map which stores the information of the BlogArticleComment;
	 * @param map
	 * @return
	 */
	@Transactional(readOnly = true)
	public BlogArticleComment createComment(Map<String,String> map);
	

	/**
	 * save the blogArticleComment;
	 * @param blogArticleComment
	 * @return
	 */
	@Transactional(readOnly = false)
	public BlogArticleComment saveBlogArticleComment(BlogArticleComment blogArticleComment);



	/**
	 * get the pre blogArticle according  to the article Date;
	 * @param blogArticle
	 * @return
	 */
	@Transactional(readOnly = true)
	public BlogArticle getPreBlogArticle(BlogArticle blogArticle);
	
	

	/**
	 * get the next  blogArticle according  to the article Date;
	 * @param blogArticle
	 * @return
	 */
	@Transactional(readOnly = true)
	public BlogArticle getNextBlogArticle(BlogArticle blogArticle);
	
	/**
	 * revert the display property Of blogArticleComment;
	 * @param blogArticleCommentId
	 */
	@Transactional(readOnly = false)
	public void revertCommentDisplay(Integer blogArticleCommentId);
	

	
	
	/**
	 * get All the category and corresponding count;
	 * @return
	 */
	@Transactional(readOnly = true)
	public List<Map<String,Object>> getCategoriesAndCount();


	/**
	 * initial the sideBar.ftl data;
	 * @return
	 */
	@Transactional(readOnly = true)
	public Map<Object,Object> initSideBar();
	

	public BlogArticleComment getCommentById(String commentId);
	
	@Transactional(readOnly = false)
	public void updateCommentContent(Map<String,String> map,Integer blogArticleCommentId);

}
